package com.zghhost.codedemo.windows;

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class ProcessDetail {
    public static void main(String[] args)throws java.io.IOException{
        String commandStr = "wmic process where \"commandline like '%java%'\" get processid,name,commandline /format:csv";
        Process p = Runtime.getRuntime().exec(commandStr);
        BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
        String line = null;
        while((line = br.readLine()) != null){
            System.out.println(line);
        }
    }
}
